 <% i=1 %>
<%  @products_group.keys.sort.each do |pg| %>  
<tr>
  
	<td rowspan="<%= @products_group[pg].length %>">
	 <%= link_to(image_tag("/images/products/#{@products_group[pg][0].category.logo}"),categories_path) unless @products_group[pg][0].category.logo.blank? %>
	<%=link_to @products_group[pg][0].category.name,categories_path %></td>
 <td><%= i %></td>
<% i+=1 %>
  <td style="text-align: left;" title="<%= @products_group[pg][0].cn_name %>"><%=link_to truncate(@products_group[pg][0].cn_name,:length =>40),product_path(@products_group[pg][0].id) %></td>
  <td style="text-align: left;" title="<%= @products_group[pg][0].en_name %>"><%=link_to truncate(@products_group[pg][0].en_name,:length =>40),"products/#{@products_group[pg][0].id}" %></td>

  <td><%=h @products_group[pg][0].per_cost %></td>
	<td><%=h @products_group[pg][0].total_amount %></td>
	<td><%=h @products_group[pg][0].least_amount %></td>
 <td><%=h -@products_group[pg][0].total_out %></td>
  <td <%= "class=lowamount" if @products_group[pg][0].remaining.to_i < @products_group[pg][0].least_amount.to_i %>><%=h @products_group[pg][0].remaining %></td>
  <td><%= link_to "编辑",edit_product_path(@products_group[pg][0]) %></td>

 
</tr>

<%  for product in  @products_group[pg][1,10000] %> 

<tr <%= "class='be_stopped'" if product.be_stopped==true %>>
 
	
	<td><%= i %></td>
	<% i+=1 %>
	 <td style="text-align: left;" title="<%= product.cn_name %>"><%=link_to truncate(product.cn_name,:length =>40),product_path(product) %></td>
	 <td style="text-align: left;" title="<%= product.en_name %>"><%=link_to truncate(product.en_name,:length =>40),product_path(product) %></td>

	 <td><%=h product.per_cost.to_i %></td>
	 <td><%=h product.least_amount.to_i %></td>
		<td><%=h product.total_amount.to_i %></td>
	<td><%=h -product.total_out.to_i %></td>
	 <td <%= "class=lowamount" if product.remaining.to_i < product.least_amount.to_i %>><%=h product.remaining.to_i %></td>
	 <td><%= link_to "编辑",edit_product_path(product) %></td>

 
</tr>
 <% end %>
 <% end %>


